/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */
 typedef struct ListNode List;
List* deleteDuplicates(List* head) {
    if(head == NULL){
        return head;
    }
    List* tail = head, *head1 = head;
    while(tail != NULL){
        if(tail->val == head1->val){
            tail = tail->next;
        }
        else{
            head1 = head1->next;
            head1->val = tail->val;
            tail = tail->next;
        }
    }
    head1->next = NULL;
    return head;
}